import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    uni(),
  ],
  build: {
    // 启用代码压缩
    minify: 'terser',
    terserOptions: {
      compress: {
        // 移除console
        drop_console: true,
        // 移除debugger
        drop_debugger: true,
      },
    },
    // 启用gzip压缩
    rollupOptions: {
      output: {
        // 代码分割
        manualChunks: {
          vendor: ['vue', 'pinia'],
        },
      },
    },
  },
  // 图片优化配置
  assetsInclude: ['**/*.gif', '**/*.jpg', '**/*.png', '**/*.webp'],
})